#ifndef DIALOGREGISTRATIONTARGETS_H
#define DIALOGREGISTRATIONTARGETS_H

#include <QMessageBox>
#include <QDialog>
#include<opencv2/opencv.hpp>
#include<QDir>

#include "dialogtargetcoordinates.h"

namespace Ui {
class dialogRegistrationTargets;
}

class dialogRegistrationTargets : public QDialog
{
    Q_OBJECT
    
public:
    explicit dialogRegistrationTargets(QWidget *parent = 0);
    ~dialogRegistrationTargets();
    void init(QString event);
    void mouseHandler(int event, int x, int y); //the real mouse handler

    // need a non-member dummy function to work with the mouse callback
    static void dummy_mouseHandler(int event, int x, int y, int flags, void *param) {
        static_cast<dialogRegistrationTargets*>(param)->mouseHandler(event,x,y);
    }

    QString projName;
    QString eventName;  //event folder name, passed from parent
    int curCam;  // current camera being worked on
    int resWidth;
    int resHeight;

    cv::Mat matCap;            //image captured

    QDir dirTargets;    //target directory for this event

    cv::Mat_<cv::Point2f> targetCam0, targetCam1;  //Image Target Points
    cv::Mat_<cv::Point3f> targetWorld;             //World Target Points

    bool targetsReady;
    bool initDone;
    bool exiting;



    
private slots:
    void on_comboBox_CameraNumber_currentIndexChanged(int index);

    void on_pushButton_GrabImage_clicked();

    void on_pushButton_ReadImage_clicked();

    void on_pushButton_SelectTargets_clicked();


    void on_pushButton_ClearTargets_clicked();

    void targetStatus();

    void on_checkBox_SaveToProject_clicked();

private:
    Ui::dialogRegistrationTargets *ui;


    cv::Mat matTarget, mat1, mat_gray;
    CvPoint   point;
    int       drag;

    std::string targetWinName;  //The name on the target selection window

    bool saveToProject;



};





#endif // DIALOGREGISTRATIONTARGETS_H
